home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 076-100 / disk_087 / commodities / manual (.txt) < prev    next >
Microsoft Windows Help File Content  |  1992-05-06  |  37KB  |  678 lines

  1. :bk=0
  2.     Commodities Exchange Reference Manual 
  3.         version 0.3, March 18, 1987
  4.     This manual and Commodities Exchange were written by Jim Mackraz.
  5.     Copyright 1987, Jim Mackraz.  No part of this manual or
  6.     accompanying software may be sold for profit or included in
  7.     any for-profit product without written authorization from
  8.     the author.
  9.     Free and at-cost distribution of this package is welcome. 
  10.     The source code for "commodities.library" is not to be compiled
  11.     for any reason without written consent of the author.  All users
  12.     of the Commodities Exchange are urged to respect the standards put
  13.     forth in the documentation.
  14.     -----    PREFACE        --------------------------------------------
  15.     This manual is the first draft of the programmer's reference to
  16.     Commodities Exchange.  It accompanies a release which might
  17.     best be called "Alpha 2" but will be referred to as "Version
  18.     0.3."  As the body of the manual describes, every attempt
  19.     has been made to provide a complete system which will enable
  20.     applications to be written in an upwardly compatible way.
  21.     The end of this document contains sort of an Appendix on the
  22.     major improvement of Version 0.3: InvertKeyMap() and the
  23.     improvement to ParseIX().   Also, AddIEvents() is new.
  24.     See also the function descriptions.
  25.     More features and utilities will address new areas.
  26.     The contents of a release are described in a file named README
  27.     on the release disk.
  28.     In addition to this document, required reading includes
  29.     the collected function references, the application #include
  30.     files, and the example applications provided.  Familiarity
  31.     with the input.device, in particular the contents of the
  32.     include file devices/inputevent.h is necessary.  Exec Lists,
  33.     Messages and Message Ports play a fundamental role in the system,
  34.     and must also be understood.  The source for the scanned support
  35.     library, cx_support.lib, is also educational.
  36.     The author wishes to warmly thank Neil Katin for his indispensible
  37.     aid and suggestions, and Andy Finkel for being a patient, yet
  38.     constant encouragement to complete the project.  Also, the team
  39.     at Meridian Software have been very helpful and encouraging.
  40.     The eventual distribution path for commodities.library has
  41.     yet to be determined.  The attempt at a copyright notice
  42.     above is trying to express these intentions:
  43.     -The library may be distributed in object form for free.
  44.     -No one makes money off of this without written consent,
  45.      which will be quite easily obtained.
  46.     -I don't want the source to the library itself compiled;
  47.      I want control over that.  Any example application or
  48.      scanned library function may be freely used for non-for-
  49.      profit programs.
  50.     -I hope people write programs which handle errors carefully,
  51.      use the ToolTypes as described, and look real sharp.
  52.     -Later versions of the library and controller may be shareware,
  53.      but arrangements can be made with anyone wishing to use
  54.      the library with a commercial product.
  55.     Lastly, I want to encourage all feedback possible.  In particular,
  56.     I would be glad to recommend approaches to your envisioned
  57.     applications, and will enhance the library to support
  58.     needed features as I become aware of them.  This manual is
  59.     also undoubtedly lacking.  Please forgive this first draft and
  60.     feel welcome in giving advice for its revision.
  61.     Please contact me by mail or in person:
  62.         Jim Mackraz
  63.         7101 Rainbow Dr. #8
  64.         San Jose, CA  95129
  65.     -----    INTRODUCTION    -------------------------------------
  66.     Commodities Exchange has as its major component an Amiga
  67.     Exec Library, named "commodities.library."  If this library
  68.     is put in logical volume LIBS:, it can be opened and used
  69.     by application programs to gain access to input in a
  70.     very flexible way.
  71.     In particular, an application of Commodities can monitor the
  72.     Amiga input stream coming from the input.device without using
  73.     an Intuition Window or a Console.  This gives rise to the
  74.     following motivational paragraphs.
  75.     The Amiga computer provides a low-overhead, message-based
  76.     multi-tasking operating environment, complete with a
  77.     multi-threaded DOS and Graphics/Windows environment.  No
  78.     other PC provides this, yet the impact sometimes seems to
  79.     be lost on the personal computing community at large.
  80.     To some degree, this is explained by surrogate multi-tasking
  81.     providing a high degree of satisfaction on popular competitors
  82.     such as the Apple Macintosh and IBM PC.  Small programs
  83.     called Desk Accessories, Pop-Up programs, Resident programs,
  84.     Terminate-and-Stay-Resident programs and the like provide multiple
  85.     application capability, with some limits.
  86.     Technical problems with the ad hoc methods of providing these
  87.     functions on existing microcomputers find their way to the
  88.     user, who must often empirically determine what programs may
  89.     safely coexist, and in what order they must be "loaded."
  90.     Most of the technical problems in writing such programs are
  91.     non-existent on the Amiga.  In particular, using disk
  92.     operating system services in pop-up programs is a black art
  93.     on an IBM PC.  A principle area of difficulty or awkwardness
  94.     is the monitoring of input, be it for the purpose of 
  95.     triggering a pop-up program, performing spelling checking as
  96.     words are typed, or translating keystrokes into sequences.
  97.     On the Amiga, the input problem is fundamentally solved by
  98.     the input.device which provides an endorsed means of adding
  99.     "input handlers."  Unfortunately, without standards, arbitrary
  100.     use of input handlers by uncooperative programs can quickly
  101.     lead to incompatibilities or "load-order dependence" even 
  102.     on the Amiga.  Furthermore, writing input handlers is far
  103.     from trivial, especially using "small model" compilation as
  104.     provided by Aztec C.
  105.     Which brings us to the goal of the Commodities Exchange.
  106.     Commodities consists of a single input handler which precedes
  107.     the Intuition input handler.  Like Intuition, Commodities
  108.     will route input events to multiple applications.  Commodities
  109.     applications typically are interested in input regardless of
  110.     what Window is active, and thus Commodities is used as a
  111.     simple, standardized way of managing the input of a "Resident"
  112.     type program.
  113.     Taken with the standards described in this document for 
  114.     user-specification of the input which triggers an action,
  115.     and for establishing the priority of individual Commodities
  116.     applications, it is hoped that many high-quality, mutually
  117.     co-existent "Resident" programs will be created by the
  118.     amazing Amiga programming community.
  119.     Next we describe the end-user's view of several Commodities
  120.     applications.  The source code for these is provided with
  121.     the release.  These programs together illustrate the most 
  122.     common principles of Commodities, and will serve as examples
  123.     for the rest of this manual.
  124.     -----    SOME EXAMPLES    ------------------------------------
  125.     To run any of the following examples, the user must put
  126.     a copy of the file "commodities.library" into his or her
  127.     LIBS: directory, where it will be found when the program
  128.     begins execution.
  129.     All applications below would normally be started from the
  130.     Workbench by opening (double-clicking) their icon.  As we
  131.     shall see, information in the icon is used to configure the
  132.     programs.
  133.     --    IHELP    --
  134.     This application is just in its infancy, I swear.  Its purpose
  135.     is to provide keyboard control of Intuition window operations,
  136.     to lessen (ultimately to eliminate) the need for using the mouse
  137.     while doing keyboard intensive work, such as writing software or
  138.     documents. 
  139.     This program was the prime motivation for the Commodities Exchange. 
  140.     It is the author's firm belief that managing a multi-tasking
  141.     user interface is too important a task to assign exclusively to a
  142.     low-bandwidth device such as a mouse.
  143.     Currently, IHelp provides three functions:
  144.     CYCLE -- this function causes the rearmost application window
  145.     on the Workbench to be brought to the front and Activated.
  146.     MAKESMALL -- the active window is shrunk to its minimum dimensions.
  147.     MAKEBIG    -- the active window is made the maximum size possible
  148.     respecting its limits and the edge of the screen.
  149.     Each of these functions is assigned to an input event, typically
  150.     a keystroke such as a function key.  Pressing the proper key
  151.     causes the action to take place regardless of which window
  152.     is active or what use the active window may be making of keyboard
  153.     input.
  154.     In order to allow the user the ability to associate keystrokes
  155.     (or other events) with these actions, the ToolType fields in
  156.     the program (Tool) icon are used.  The user selects (but does
  157.     not open) the icon for IHelp, and selects "Info" from the
  158.     Workbench menu.  The subsequent display allows the addition,
  159.     editing, and deletion of parameter strings called ToolTypes.
  160.     To assign the three functions above to new keystrokes, ToolType
  161.     items are added or edited to read, for example:
  162.     CYCLE=f1
  163.     MAKEBIG=alt f5
  164.     MAKESMALL=shift alt f5
  165.     The icon is saved, and the next time IHelp is loaded these
  166.     keystrokes prescribed by the user will be associated with
  167.     the program's actions.
  168.     --    NOCAPSLOCK    --
  169.     This application is almost invisible to the user.  It monitors
  170.     all keystrokes and insures that the CAPSLOCK key on the keyboard
  171.     never has any effect (regardless of what its little red light
  172.     says).
  173.     The shift keys still function normally, but the frequent annoying
  174.     effects of inadvertant pressing of the CAPSLOCK key are no more.
  175.     This program provides nothing the user would want to change, 
  176.     so no ToolType fields in its icon are used.
  177.     --    AUTOPOINT2    --
  178.     This function was inspired by Jude Katsch's Autopoint, which
  179.     is a program to emulate SunWindows style window activation.
  180.     Whenever the mouse is moved (without a button depressed) this
  181.     program triese to activate the window under the mouse pointer
  182.     if it is not already active.
  183.     The tricky part of this program was to make it work with the
  184.     Workbench Rename gadget, which it does nicely.
  185.     Again, no ToolType fields are used.
  186.     -----    COMMODITIES COMPONENTS    -------------------------------
  187.     The Commodities Exchange consists of several identifiable
  188.     components which we introduce now.
  189.     --    commodities.library    --
  190.     This is an Amiga Exec library which creates an input handler
  191.     when it is initialized.  It provides a large number of functions
  192.     to manipulate Commodities Objects and Messages, the building
  193.     blocks of a Commodities application.  All access to data
  194.     used by this library is done procedurally: no internal data 
  195.     structures are read or modified directly by application programs.
  196.     The functions provided by the library fall into classes:
  197.         -Object Creation/Deletion
  198.         -Object Linking
  199.         -Object Data Access/Modify
  200.         -Object Type-specific Functions
  201.         -Input Event Matching Utilities
  202.         -Message Routing/Disposing
  203.     The library must be opened (using the Exec function OpenLibrary())
  204.     by each Commodities application.
  205.     All parameters to the library, following Amiga library convention,
  206.     are thirty-two bit quantities.  Small-integer users must remember
  207.     that integers and characters are not promoted to thirty-two
  208.     bits by the compiler, so casts must be used.  In particular,
  209.     don't forget to cast boolean and priority values to (LONG).
  210.     --    Controller program    --
  211.     An application program will be used to see the loaded Commodities
  212.     and their functions.  It will be possible to use this program
  213.     to terminate an application.  It is an unrealized design goal
  214.     to write the controller using public information and interface
  215.     functions so that it would be upwardly object compatible.
  216.     In fact, the controller, if it exists at all, is very rudimentary
  217.     at the present time.
  218.     --    Support Scanned Library    --
  219.     A "scanned" library is also provided.  Its name is "cx_support.lib."
  220.     A scanned library contains functions which are linked into the
  221.     executable file of an application.  Included are interface routines
  222.     to commodities.library and some utility functions.  The functions
  223.     are all compatible with Aztec C conventions, and are compiled
  224.     "small code, small data, small integer."
  225.     --    Include Files    --
  226.     Various include files are provided.  For applications, the file
  227.     "cxusr.h" contains the principle information and itself includes
  228.     the other application include files.  The file "cx.h," if you ever
  229.     see it, contains library private data structures and constants
  230.     which are not guaranteed to be compatible from release to release.
  231.     They should not be used by any Commodities applications.
  232.     Assembler versions of the include files don't exist yet.
  233.     --    Source Examples    --
  234.     As mentioned, the source for the programs IHelp, NoCapsLock, and
  235.     AutoPoint2 is provided.
  236.     --    Commodities Applications    --
  237.     You write these.  They open "commodities.library" and perhaps
  238.     use functions in the scanned library.  They create and interconnect
  239.     objects (see below) in such a way that particular events cause
  240.     desired actions or notifications.
  241.     -----    COMMODITIES OVERVIEW    -------------------------------
  242.     --    Objects and Messages    --
  243.     The basic building block is the Commodities Exchange Object,
  244.     or CxObj.  Each object is of some particular 'type' which
  245.     corresponds to the primitive action that occur when a Commodities
  246.     Message arrives at the object.  The objects are connected together
  247.     in a large tree structure and messages corresponding to input events
  248.     rattle down different paths in the tree, triggering different actions
  249.     as they encounter different objects.
  250.     One particular object type is the Custom object, which calls an
  251.     application provided function when a CxMsg arrives, so that
  252.     programmers can provide virtually any function not available with
  253.     the standard CxObj types.
  254.     A Commodities Exchange Message, or CxMsg, corresponds with few
  255.     exceptions to a single Input Event.  When such a message arrives
  256.     at a CxObj, an action takes place.  This action might be
  257.     the sending of an Exec message to an application message port, the
  258.     diversion of the CxMsg down a sub-tree, or the calling of
  259.     an application-provided function. 
  260.     All objects can be disabled (inactivated), which inhibits any
  261.     action being taken when a CxMsg arrives.  The message simply
  262.     proceeds along to its default next destination.
  263.     Each CxObj is itself an Exec Node; one finds objects linked
  264.     together in linear lists.  Each object also contains a List
  265.     Header, which we refer to as its "personal list," so branching
  266.     off from any object can be another list.  So although the entire
  267.     linked structure of CxObj's is indeed a tree, there is a definite
  268.     preferred--or default--direction at each node of the tree.
  269.     Starting with a Master List of CxObj's, CxMsg's tend to visit
  270.     every object in a list in turn, but certain objects can divert
  271.     them "90 degrees" whence they head off down another list, normally
  272.     the "personal list" of the CxObj performing the diversion.
  273.     When (and if) the CxMsg reaches the end of a list, it proceeds
  274.     from where it was diverted.  A stack is maintained for
  275.     each CxMsg to record and recover from multiple diversions.
  276.     --    Brokers and Application Sub-Trees    --
  277.     The CxObj's in the Master List are a special lot.  They
  278.     are called Commodities Brokers (get it?) and are typically in
  279.     one-to-one correspondence with application programs.  They
  280.     are "representatives" of the application programs; the
  281.     sub-tree starting with the personal list of a Broker consists
  282.     of the CxObj's created by the application.
  283.     When it is enabled, a Broker will divert ALL CxMsg's it receives
  284.     down its personal list, into the network of objects the
  285.     application has set up.
  286.     Support is provided for preventing the creation of duplicate
  287.     brokers.  This gives the application an easy way of determining
  288.     during its initialization if there is another copy of itself
  289.     already running.  The new copy can terminate, and it can be
  290.     arranged that the existing copy be notified that a restart
  291.     attempt was made.  A resident but dormant pop-up notepad program
  292.     might take such a notification that it should open up a window
  293.     and swing into action.
  294.     --    Standard Objects    --
  295.     The actions performed by CxObj's of the standard types are intended
  296.     to be primitive.  An application wishing to receive an Exec message
  297.     when a particular keystroke occurs must create three CxObj's for
  298.     the task: one to filter the CxMsg's for one corresponding to 
  299.     the keystroke, and attached to its list, a CxObj to send off
  300.     an Exec Message and another (optional) to swallow the CxMsg.
  301.     These three are in addition to the application's (single) broker.
  302.     A filter acts by diverting a select set of CxMsg's down its
  303.     personal list, where they will encounter the other two objects
  304.     who unconditionally perform their action.
  305.     Here is a summary of the CxObj types and a brief description
  306.     of each:
  307.         Broker    --    only CxObj's on Master List
  308.                     contain a description of the application
  309.                     diverts everything down its personal list
  310.         Filter    --    if CxMsg matches some expression, divert 
  311.         TypeFilter-    if CxMsg has type in specified set, divert
  312.         Signal    --    signals some task when any CxMsg arrives
  313.         Sender    --    sends copy of CxMsg to some port (asynchronous)
  314.         Translate-    replaces CxMsg with a chain of zero or more
  315.                     new input event CxMsg's
  316.         Debug    --    dumps message contents to debug device (kprintf)
  317.         Custom    --    calls a programmer-provided function (synchronous)
  318.     There is a more detailed description in the Function Reference
  319.     sections for the functions which create the various types of 
  320.     CxObj.
  321.     --    Custom Objects    --
  322.     Custom objects take a unique action.  They call a function
  323.     provided by the application SYNCHRONOUSLY with the execution of
  324.     the Commodities handler.  The delicacy of this cannot be over-
  325.     emphasized.  The function will execute as part of the input.device
  326.     task.  No DOS or Intuition functions may be called.  Although
  327.     the handoff saves and restores all registers, no assumptions
  328.     can be made about the values of registers upon entry.  For
  329.     Aztec C functions, it is sufficient (and necessary!) to call
  330.     the function geta4() (Aztec provided) to establish the context
  331.     register for the routine.
  332.     All such functions should be kept quick and simple, with a
  333.     MINIMUM of stack usage.  A Custom CxObj is the only way to
  334.     directly modify input events as their CxMsg's proceed
  335.     through the Commodities network, but uses other than that 
  336.     should be thought about long and hard and again.
  337.     --    Input Events and Matching Conditions    --
  338.     As mentioned above, most CxMsgs correspond to InputEvents.
  339.     Now is a good time to reread the Chapter 9, The Input Device,
  340.     in the ROM Kernel Reference Manual, volume 2.  See also
  341.     the include file devices/inputevent.h.
  342.     Each input event which reaches the Commodities handler is neatly
  343.     copied into a CxMsg and sent through the CxObj network.
  344.     If it makes it all the way through (i.e., to the end of the Master
  345.     List) the contents--which may have been changed by some object--
  346.     are copied into an input event and sent along to subsequent
  347.     input handlers, including Intuition, and along to Window
  348.     (i.e., non-Commodities) applications.
  349.     Flow of an input event CxMsg is determined by its interactions
  350.     with filter objects.  Each filter object has a "matching condition"
  351.     assigned by the application which determines which messages will
  352.     be diverted down the filter's personal list (those that match).
  353.     The internal representation of this matching condition is private,
  354.     but can be specified by two mechanisms.  Enhancements and additions
  355.     to these mechanisms can be expected; provisions for upward
  356.     compatibility are made for both.
  357.     We spend some time going through the currently available capabilities
  358.     in some detail, since they have avoided documentation elsewhere.
  359.     -- Input Description Strings --
  360.     NOTE: This material is significantly changed for version 0.3
  361.     These are the character strings found in the ToolTypes fields
  362.     described in the introduction to the sample program IHelp.
  363.     Each string described a subset of input events.
  364.     [class] [{[-](qual | syn)}] [[-]upstroke] [highmap|ansicode]
  365.     which means an optional class (default is RAWKEY), zero or
  366.     more qualifiers, and a mandatory code value,  where "class,"
  367.     "qualifier," and "code" in lower case, from the following list:
  368.     class    --     
  369.         one of the strings: 
  370.         rawkey, rawmouse, event, pointerpos, timer, newprefs,
  371.         diskremoved, diskinserted.
  372.         If not specified, the class is taken to be "rawkey."
  373.     qual    --
  374.         one of the strings: 
  375.         shift, rshift, capslock, control, lalt, ralt, lcommand, rcommand,
  376.         numericpad, repeat, midbutton, rbutton, leftbutton, relativemouse,
  377.         A preceding '-' means that the value of the corresponding
  378.         qualifier is to be considered irrelevant.
  379.     syn        -- (synonym)
  380.         one of the strings: shift, caps, alt
  381.         shift    (means "left or right shift"), caps    (means "either shift
  382.         or capslock"), alt (means "either alt key").
  383.     upstroke--     (literally "upstroke")
  384.         if this token is absent, only downstrokes are considered
  385.         for rawmouse (mousebuttons) and rawkey events.  If it is
  386.         present alone, only upstrokes count.  If it preceded by
  387.         '-' it means that both up and down strokes are included.
  388.     highmap    --
  389.         one of the strings: 
  390.         space, backspace, tab, enter, return, esc, del, up, down,
  391.         right, left, help, f1, f2, f3, f4, f5, f6, f7, f8, f9, f10.
  392.     ansicode --
  393.         a single character token is interpreted as a character code,
  394.         which is looked up in the system default keymap. 
  395.     Examples of strings are:
  396.         "lshift right alt f2"
  397.         "alt shift a"
  398.         "-shift -alt -control help" (help key with or without qualifiers)
  399.         "rawmouse rbutton"        (mouse move with menu button down)
  400.     Enhancements to the grammar are anticipated.  Every attempt
  401.     will be made to be compatibile with the input descriptions
  402.     of the early version.
  403.     --    Input Expressions    --
  404.     Applications can also use a powerful binary specification of
  405.     the matching condition for a filter.  In the future, perhaps
  406.     a more powerful specification may be developed so the data 
  407.     structures for the Input Expressions (type IX) are tagged with
  408.     their version number.  This will allow easy handling of different
  409.     specification types co-existing in a future Commodities
  410.     version.
  411.     The Version 2 IX structure is as follows and the conditions that
  412.     it specifies a match with an InputEvent are described:
  413.     typedef struct {
  414.         UBYTE    ix_Version;
  415.         UBYTE    ix_Class;
  416.         UWORD    ix_Code;
  417.         UWORD    ix_CodeMask;
  418.         UWORD    ix_Qualifier;
  419.         UWORD    ix_QualMask;
  420.         UWORD    ix_QualSame;
  421.     } IX;
  422.     ix_Version -- must be set to the manifest constant IX_VERSION
  423.     found in the same include file ("ix.h") as the structure
  424.     definition.
  425.     ix_Class  -- must exactly equal the ie_Class field of an InputEvent
  426.     to match.
  427.     ix_Code, ix_CodeMask -- for every bit set in ix_CodeMask, the
  428.     state of the corresponding bits in ix_Code and ie_Code in the
  429.     InputEvent must match.  Note that whether a keystroke or mouse
  430.     button action is a down- or upstroke is encoded in the
  431.     ie_Code field of the InputEvent (IE_CODE_UPPREFIX).
  432.     ix_Qualifier, ix_QualMask, ix_QualSame -- the fields ix_QualMask
  433.     and ix_QualMask work in the same way as for the Code: the Mask
  434.     indicates the "do care" bits in ie_Qualifier, with ix_Qualifier
  435.     specifying the required settings for those bits.  The ix_QualSame
  436.     field is used to express simple synonyms in the ie_Qualifier.
  437.     Using this, you can specify that left- and right Shift- are
  438.     equivalent and whether the CAPSLOCK qualifier is also equivalent.
  439.     Left- and right-Alt can also be made equivalent.
  440.     --    Message Routing    --
  441.     So far a few points have come out about routing CxMsg's:
  442.     -In the absence of some action diverting them, after visiting
  443.      a CxObj, they will proceed to the next node in the same list.
  444.     -They may be diverted down the "personal list" of some CxObj,
  445.      normally the list belonging to the object doing the diverting.
  446.      Diverting consists of pushing the address of the current CxObj
  447.      onto an internal stack and routing to the first CxObj in the list.
  448.     -When they reach the end of a list of CxObj's, the address of a
  449.      CxObj is popped off of their stack, and they proceed to the
  450.      Successor of that object.
  451.      Reaching the end of the Master List sends the CxMsg to an internal
  452.      "Zero Object" which disposes of the message, first recovering
  453.      InputEvents from the contents of input event messages.
  454.     Application programs (using Custom Objects) can route a message
  455.     two ways: diverting it down the list of some object, or by routing
  456.     it directly to another object.  Future functions may be provided
  457.     for independently pushing or popping the routing stack.
  458.     Note that it makes no sense and is indicative of greater misunder-
  459.     standing to try to route a message sent to a port by a sender
  460.     CxObj.
  461.     -----    The Examples, Revisited        ----------------------------
  462.     With the background so far, it is helpful to consider the object
  463.     structure used by the example programs discussed above.
  464.     -- IHelp --
  465.     IHelp has three "hotkeys."  These are triads of objects discussed
  466.     briefly above.  There is a routine in the support library that
  467.     creates these groups of objects easily.
  468.     A hotkey triad, to review, consists of a filter object, which
  469.     is the "trigger" for the hotkey.  Attached to its personal list
  470.     is a sender which sends a notification message to a port allocated
  471.     by IHelp. 
  472.     The ID field of the several senders differ, so that IHelp can
  473.     easily tell from which sender the messages were sent.  IHelp
  474.     pays no attention to the data part of the messages it is sent.
  475.     Following the sender in the personal list of the filter is a
  476.     translator object which translates the trigger CxMsg to NULL,
  477.     in effect swallowing it.
  478.     IHelp, like all good Commodities, has a Broker, and the filter
  479.     objects at the head of the hotkeys are all attached to its list.
  480.     --    NoCapsLock    --
  481.     Attached to the Broker list of this application is a single filter
  482.     which watches for all RAWKEY events which have the CAPSLOCK bit
  483.     set.  It diverts them down its list where a single custom object
  484.     can be found.
  485.     This custom object modifies the InputEvent included in each CxMsg
  486.     it encounters, clearing the CAPSLOCK bit.  It has no effect on
  487.     other Qualifier bits, so even if the CapsLock key is active, the
  488.     shift keys will function normally.
  489.     --    Autopoint2    --
  490.     Attached to the Broker is a single filter, watching for RAWMOUSE
  491.     events with neither mouse button depressed.  CxMsgs carrying such
  492.     events are diverted down to a signal CxObj, which wakes up the
  493.     AutoPoint task.  Once awakened it does magic.
  494.     Note that a signal is just the ticket for this function, saving the
  495.     overhead of creating, sending, and replying to an Exec message.
  496.     -----    More Details    ----------------------------------------
  497.     --    Error Handling    --
  498.     A well-behaved program must always check that functions which
  499.     create CxObj's succeed, since each object requires some dynamically
  500.     allocated memory.  To make this a little less tedious, it is
  501.     possible to get by testing if entire list of objects was created
  502.     successfully, and to recover gracefully if not.  See the examples.
  503.     And check for and handle all errors, OK?
  504.     --    ToolTypes and the Commodities Environment    --
  505.     Some functions are provided to make it easy to use ToolTypes
  506.     for providing user control over the parameters of your
  507.     application.  Please let the user specify the input description
  508.     for major semantic actions in your programs. 
  509.     Also, even if there is no obvious reason in some cases, let the
  510.     user set the priority for your broker.  That is the key step to
  511.     making the functioning of a group of Commodities applications
  512.     independent of the order in which they were loaded.
  513.     Note that the functions provided also support command line
  514.     argument parsing so Commodities can be started from the
  515.     CLI with full user control (this is especially useful for
  516.     starting up a batch of applications from an Execute script file).
  517.     --    Library version    --
  518.     Be sure to specify a non-zero version number to the OpenLibrary()
  519.     call when opening Commodities.  This insures that the end user
  520.     does not use your program with a version of the library that
  521.     doesn't support new features you are depending on.
  522.     --    Terminating a Commodities Application    --
  523.     As is shown in the examples, the proper terminating condition of a
  524.     Commodities application is the receipt of the Control-E break signal.
  525.     This signal will be sent by controller software to the task which
  526.     created a Broker when the user indicates that that Broker's program
  527.     is to be terminated.  It is also easy to send such a signal to 
  528.     a background task started from the CLI.  Use the "Status" command
  529.     to find the tasks CLI ID, and then say "Break task <n> E" where
  530.     <n> is the number from the Status output.
  531.     Developing a Commodities application is made more convenient 
  532.     using this convention (we often test them in the foreground,
  533.     and typing Control-E usually works long before the rest of the
  534.     program), and we also don't waste function keys or other input
  535.     combinations on termination commands.
  536.     --    Pools and Alerts    --
  537.     The internal data structures used by the Commodities library are
  538.     allocated and managed by a common "Pool" mechanism.  Normally,
  539.     this mechanism is invisible to the programmer and end-user.  It
  540.     is used to manage data storage for Commodities objects, messages,
  541.     Exec messages, and InputEvents.
  542.     In the early releases of Commodities, however, this one included,
  543.     a recoverable alert will be put up if a program corrupts the
  544.     secret header of a Commodities data structure, or uses an invalid
  545.     handle in certain operations.  Another recoverable alert is
  546.     posted when commodities.library expunges (which is done when the
  547.     last application closes the library) if all data structures are
  548.     not returned to Commodities before this time.  The frequent
  549.     causes for this are not replying to all the Exec messages Commodities
  550.     senders send to you, and not deleting all the objects that you
  551.     have created.
  552.     To properly reply all Exec messages sent to your program, a sequence
  553.     like that used in IHelp is advised:
  554.         DeleteCxObjAll(broker);
  555.         while (msg = GetMsg(port)) ReplyMsg(msg);
  556.         CloseLibrary(CxBase);
  557.     -----    Future Versions and Compatibility    -------------------
  558.     As stated in the Preface, this version of Commodities Exchange is
  559.     not complete, with a few important things not present.  In this
  560.     section we discuss things to come and compatibility issues.
  561.     -- Controller    --
  562.     Prominent in its absence is the controller application that will
  563.     allow the user to view (the brokers of) all the Commodities
  564.     applications, experiment with their priority, temporarily disable
  565.     them, and terminate them.
  566.     It was a design goal to provide enough procedural interface through
  567.     the library to allow a "legal" application to walk through the
  568.     Commodities object tree and report what it sees, but implementation
  569.     of that interfered with the main functions of the library.
  570.     Until at least a rudimentary controller is made available, Commodities
  571.     applications are best started from the CLI, so that they may be
  572.     terminated by the CLI "Break" command (using the Control-E signal).
  573.     Note that the "ToolTypes" parameter environment can be specified
  574.     on the CLI command line, like so:
  575.         run ihelp "CYCLEBACK=alt shift f5"
  576.     -- User Visible Filters    --
  577.     Another dream for the controller is that it could report on some
  578.     of the hotkeys or other event triggers that an application had
  579.     installed.  This would provide, for example, an easy way for the
  580.     user to see exactly what key cycles the windows in IHelp.
  581.     To accomplish this, an extension will need to be made of the
  582.     Filter, with the application further specifying descriptive text
  583.     for user-visible filters, and whether the user may modify the
  584.     event matching condition, and what restrictions apply to his
  585.     modifications.  Prototypes of this have been played with, but
  586.     the inclusion into the library will have to wait.  Existing
  587.     filters will always be compatible, but even those that should
  588.     be visible to the user never will be.
  589.     --    Active Window Knowledge    --
  590.     It is in the plans to hang another Commodities input handler
  591.     on the input.device handler chain, but FOLLOWING Intuition 
  592.     instead of preceeding (but preceding the Console).
  593.     This would allow a keystroke enhancer to make different translations
  594.     for different windows.  Another use of such a thing would be to
  595.     allow non-interactive programs (i.e., those with no window) be
  596.     informed of a preferences change.
  597.     This will manifest itself as a new flag bit that can be set in
  598.     the NewBroker structure to indicate post-Intuition processing,
  599.     and a new kind of filter which only diverts events if a particular
  600.     window is active.
  601.     Religiously setting all undefined NewBroker.nb_Flags bits to zero
  602.     will insure compatibility with this change.
  603.     --    BindCommodities    --
  604.     In spite of the lack of a controller today, the preferred method
  605.     of starting a Commodities application and establishing a parameter
  606.     environment will be through the use of icons.
  607.     In the meantime, one can start up several Commodities applications
  608.     with a batch file (which can't be run from the start-up script since
  609.     jobs left in the background prevent the Initial CLI from closing).
  610.     When we make it to icons, we will need a way to start up a collection
  611.     of Commodities by referencing their icons.  Neil "Workbench" Katin,
  612.     author also of BindDrivers, pledges a similar program which will 
  613.     start every program with an icon in some specified drawer, with
  614.     their start-up environment being identical to that when started
  615.     from the Workbench.
  616.     Such a program will have myriad uses (starting notepads, etc.) but
  617.     our interest will be in starting a directory full of Commodities
  618.     applications.
  619.     --    Timer Support    --
  620.     Right now, events of type IECLASS_TIMER don't go through the
  621.     Commodities object network, largely because there wasn't time
  622.     to profile the performance of the system, and they are a frequent
  623.     and low-payoff burden.
  624.     A new standard object, the "One-Shot Timer Filter," will someday
  625.     exist, which will be set to some unsigned integer value by the
  626.     application.  Each time a TIMER event passes its way, it will
  627.     decrement the count.  When the count reaches zero, ONE timer
  628.     CxMsg will be diverted down the filter's personal list, and
  629.     the filter will then become dormant until the count is reset.
  630.     --    Profile and Downcode    --
  631.     We don't know how slow this beast is, especially with lots and
  632.     lots of objects.  Existing profilers don't apply to Exec library
  633.     code, and there hasn't been any time to do something about it.
  634.     With the timers eliminated, the author's experience hacking Intuition
  635.     indicates that human-schedule input is pretty slow, and that any
  636.     input-response bottleneck typically occur on the output side of
  637.     the fence.  That is to say, we hope it's fast enough.  There
  638.     are several routines which are prime contestants for assembly
  639.     language downcoding.
  640.     If there is sufficient uproar, we will break apart the library
  641.     interface functions of the scanned library into separate files,
  642.     so that your program will only link in just the interface code
  643.     it needs.
  644.     -- Keystroke Programmers    --
  645.     Although lots of features are present to make writing a keystroke
  646.     macro utility much easier, reports of direct experience returned
  647.     to the author will undoubtedly show areas of needed change.  We
  648.     will try to be most responsive to people forging new ground.
  649.     -- More CxMsg Types    --
  650.     There are only two types of Commodities Messages currently:
  651.     CXM_IEVENT, by far the most common; and CXM_UNIQUE, which notifies
  652.     Brokers who are interested that another attempt was made to start
  653.     their applications.
  654.     More may be coming, perhaps in support of Post-Intuition Commodities.
  655.     Program defensively by not assuming anything about the type of
  656.     a CxMsg unless that message has passed through a filter of some
  657.     sort.
  658.     --    Support for More Languages    --
  659.     Commodities Exchange was developed under Aztec-C, and the scanned
  660.     library cx_support.lib is an Aztec convention, small model library.
  661.     Amiga type naming, as found in exec/types.h, are used exclusively
  662.     in commodities.library, but some 'ints' sneaked into cx_support.lib.
  663.     Support for other compilers, languages, and assembler should be
  664.     done someday.  Particularly lacking are assembler include files.
  665.     --    Documentation    --
  666.     Hopefully, the state of this manual will succumb to revision.
  667.     APPENDIX (for now)
  668.     Three big changes have been added:
  669.     The function InvertKeyMap() converts an ANSI character code
  670.     to the InputEvent that maps to it (using KeyMaps).  This function
  671.     is used by the function InvertString() which translates a special
  672.     extension of ANSI character strings into a chain of input events. 
  673.     ParseIX() has been greatly enhances (and tested a little).  See
  674.     the description above, in this document.
  675.     AddIEvents() provides a trivial method of adding a chain of 
  676.     input events to the Input Food Chain starting before Commodities.
  677.     See the function descriptions for more information.
  678.